/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SPATIAL_SOFTBUS_SESSION_H
#define SPATIAL_SOFTBUS_SESSION_H

#include <set>
#include <vector>
#include <string>

#include "session.h"
#include "single_instance.h"
#include "softbus_common.h"

namespace OHOS {
namespace Msdp {
class SpatialSoftbusSession {
DECLARE_SINGLE_INSTANCE_BASE(SpatialSoftbusSession);
public:
    int32_t Start();
    int32_t Stop();
    int32_t OpenSoftbusSession(const std::string &peerDeviceId);
    void CloseSession(int32_t sessionId);
    int32_t SendMessages(const char *deviceId, std::vector<std::string> &messages);
    int32_t SendMsg(int sessionId, const void *data, unsigned int len);
    int32_t SendBytes(int32_t sessionId, const void *data, int32_t len);
    int GetPeerDeviceId(int32_t sessionId, std::string &peerDevId);
    bool IsServer(int sessionId);

private:
    SpatialSoftbusSession() = default;
    ~SpatialSoftbusSession();
    bool sessionServerExist_ {false};
    bool sessionOpened_ {false};
    std::set<int32_t> sessionIdSet_;
    std::vector<std::string> messages_ {};
    const std::string PKGNAME = "ohos.msdp.spatialawareness";
    const std::string SESSION_NAME = "ohos.msdp.spatialawareness.session";
};
} // namespace Msdp
} // namespace OHOS
#endif // SPATIAL_SOFTBUS_SESSION_H